package com.kmust.dream.wanderingdream.donation.controller;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

import com.kmust.dream.wanderingdream.comm.utils.PageUtils;
import com.kmust.dream.wanderingdream.comm.utils.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.kmust.dream.wanderingdream.donation.entity.AuditDonationPublicEntity;
import com.kmust.dream.wanderingdream.donation.service.AuditDonationPublicService;
import org.springframework.web.servlet.DispatcherServlet;


/**
 *
 *
 * @author Leng
 * @email Leng81605@gmail.com
 * @date 2021-07-11 14:11:07
 */
@Api(tags = "审核捐赠")
@RestController
@RequestMapping("donation/auditdonationpublic")
@Deprecated
public class AuditDonationPublicController {
    @Autowired
    private AuditDonationPublicService auditDonationPublicService;

    /**
     * 列表
     */
    @GetMapping("/list")
    @ApiOperation("返回分页")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = auditDonationPublicService.queryPage(params);


        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @GetMapping("/info/{donationInformationId}")
    @ApiOperation("通过id获取记录")
    public R info(@PathVariable("donationInformationId") Integer donationInformationId){
		AuditDonationPublicEntity auditDonationPublic = auditDonationPublicService.getById(donationInformationId);

        return R.ok().put("auditDonationPublic", auditDonationPublic);
    }

    /**
     * 保存
     */
    @PostMapping("/save")
    @ApiOperation("保存记录")
    public R save(@RequestBody AuditDonationPublicEntity auditDonationPublic){
		auditDonationPublicService.save(auditDonationPublic);

        return R.ok();
    }

    /**
     * 修改
     */
    @PutMapping("/update")
    @ApiOperation("更新记录")
    public R update(@RequestBody AuditDonationPublicEntity auditDonationPublic){
		auditDonationPublicService.updateById(auditDonationPublic);

        return R.ok();
    }

    /**
     * 删除
     */
    @DeleteMapping("/delete")
    @ApiOperation("删除记录")
    public R delete(@RequestBody Integer[] donationInformationIds){
		auditDonationPublicService.removeByIds(Arrays.asList(donationInformationIds));

        return R.ok();
    }

}
